package com.ysd.lis.controller.lab;


import com.ysd.lis.annotation.LogDetail;
import com.ysd.lis.aspect.OperationType;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.PubReport;
import com.ysd.lis.entity.lab.LabUnqualifiedGroup;
import com.ysd.lis.request.AddAndUpdateUnqualiGroup;
import com.ysd.lis.request.DeleteParam;
import com.ysd.lis.service.lab.LabUnqualifiedGroupService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ysd.common.Result;

/**
 * <p>
 * 不合格原因设置表 前端控制器 
 * </p>
 *
 * @author Bai
 * @since 2024-02-02
 */
@RestController
@RequestMapping("/lab/unqualified/group")
public class LabUnqualifiedGroupController extends BaseController {
    @Autowired
    LabUnqualifiedGroupService unqualifiedGroupService;

    //获取不合规信息
    @ApiOperation("获取不合规原因信息（不分页)")
    @GetMapping("/getUnqualifiedListNoPage")
    public Result getUnqualifiedList(LabUnqualifiedGroup labUnqualifiedGroup) {
        return unqualifiedGroupService.getUnqualifiedList(labUnqualifiedGroup);
    }

    //新增不合格原因组信息
    @ApiOperation("新增不合格原因组信息")
    @PostMapping("/addGroup")
    @LogDetail(requestParam = "addGroup", operationType = OperationType.INSERT, module = "不合格原因管理", content = "通过检验模块，使用不合格原因设置功能新增了：【groupNames】不合格原因组")
    public Result addGroup(@RequestBody AddAndUpdateUnqualiGroup addAndUpdateUnqualiGroup) {
        return unqualifiedGroupService.addGroup(addAndUpdateUnqualiGroup);
    }
    @ApiOperation("修改不合格原因组信息")
    @PostMapping("/updateGroup")
    @LogDetail(requestParam = "updateGroup", operationType = OperationType.UPDATE, module = "不合格原因管理", content = "通过检验模块，使用不合格原因设置功能修改了：【groupNames】不合格原因组")
    public Result updateGroup(@RequestBody AddAndUpdateUnqualiGroup addAndUpdateUnqualiGroup) {
        return unqualifiedGroupService.updateGroup(addAndUpdateUnqualiGroup);
    }

    @ApiOperation("删除不合格原因组信息")
    @PostMapping("/daleteGroup")
    @LogDetail(requestParam = "daleteGroup", operationType = OperationType.DELETE, module = "不合格原因管理", content = "通过检验模块，使用不合格原因设置功能删除了：【names】不合格原因组")
    public Result daleteGroup(@RequestBody DeleteParam deleteParam) {
        return unqualifiedGroupService.daleteGroup(deleteParam);
    }
}